API Gateway v3.0.0
NINJIO API Gateway, version 3.0.0.
Every endpoint below lives under /api/api_gateway/3.0.0/. The version is part of the address, so 2.x
keeps serving its own URLs untouched and you move one call at a time.
Authentication
Send your API key as the apiKey header. The key determines which account you are
acting for and which scopes you hold; a call to an endpoint your key does not carry the
scope for is refused with 403.
curl "https://apigw.goninjio.com/api/api_gateway/3.0.0/customer/employees/" \
-H "apiKey: YOUR_API_KEY_HERE"
One shape for every list
Rows always arrive under data, alongside the same paging fields:
{
"data": [ ... ],
"page": 1,
"page_size": 100,
"num_pages": 3,
"total_items": 214,
"has_next": true,
"has_previous": false,
"next_cursor": "eyJ2IjpbWyJpIiwxMDFdXSwiZCI6ImYiLCJvIjoicGsifQ",
"previous_cursor": null
}
In 2.x each endpoint invented its own spelling: rows under employees, templates,
trainings, data, or in a bare array with no envelope at all; page size spelled
page_size, per_page, items_per_page or amount; and the same two numbers repeated
under four names. One shape replaces all of it, so a single parser works everywhere.
Paging
?page= walks by ordinal position and is the simplest thing for a small result set or a
numbered UI.
?cursor= is keyset paging and is the better choice for walking a whole resource: it
does not slow down as you go deeper, and it cannot skip or repeat a row when data changes
underneath you. Follow next_cursor until has_next is false, and treat the cursor as
opaque.
Every response carries a next_cursor, including in offset mode, so a client can switch
to cursor paging mid-walk without starting over.
If you do not need the total, ?include_total=false returns total_items: null and
num_pages: null, and the COUNT(*) that produces them is not run at all. That holds in
both paging modes, so it is worth setting on any walk where nothing displays a total.
A ?page= beyond the last one is an empty page, not the last page: the response reports
the page you asked for, with data: [] and has_next: false.
filters_applied
A response that was narrowed by a filter also reports what narrowed it:
"filters_applied": { "country": "Israel", "active": false }
The values are the ones the server parsed, not the strings you sent, so ?active=yes
comes back as true. The key is absent when nothing was filtered -- an absent key
means you are looking at the unfiltered set, which an empty object would leave ambiguous.
Paging parameters are not filters and never appear.
Errors
One shape, everywhere: {"error": "..."}. A malformed parameter is 400, a resource
that does not exist -- or does not belong to your account -- is 404, and a missing or
insufficiently scoped key is 403.
Authentication
- API Key: apiKeyAuth
Security Scheme Type: | apiKey |
|---|---|
Header parameter name: | apiKey |